package com.sakiko.ollama.controller;

import org.springframework.ai.chat.model.ChatModel;
import org.springframework.ai.ollama.OllamaChatModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * projectName: com.sakiko.ollama.controller
 *
 * @author: Yang
 * description: ollama 本地模型测试
 * time: 2025/8/8 21:46
 */
@RestController
@RequestMapping("ollama")
public class OllamaController {

    @Autowired
    private OllamaChatModel chatModel;

    @GetMapping("r1")
    public String deepseek(@RequestParam(value = "msg", defaultValue = "hello") String message) {
        return chatModel.call(message);
    }

    @GetMapping("oss")
    public String openai(@RequestParam(value = "msg", defaultValue = "hello") String message) {
        return chatModel.call(message);
    }

}
